package com.narbeshuber.tablet.lasalara.fragment;

import android.app.Fragment;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.narbeshuber.tablet.lasalara.LasaLaraActivity;
import com.narbeshuber.tablet.lasalara.R;

public class InfoFragment extends Fragment {
	
	public enum LayoutType{
		LOGIN,
		STUDY,
		BOOK,
		CHAPTER,
		DEFAULT
	}
	
	private LayoutType layoutType;
	
	public InfoFragment(LayoutType layoutType){
		this.layoutType = layoutType;
	}
	
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View v;
		if (layoutType == LayoutType.LOGIN) {
			v = inflater.inflate(R.layout.logininfolayout, container, false);
		} else if (layoutType == LayoutType.DEFAULT) {
			v = inflater.inflate(R.layout.infolayout, container, false);
			TextView basicInfo = (TextView)v.findViewById(R.id.basic_info);
			if(basicInfo!=null){
				if(LasaLaraActivity.ninjaMode){
					basicInfo.setTextColor(Color.WHITE);
				} else {
					basicInfo.setTextColor(Color.BLACK);
				}
			}
		} else if (layoutType == LayoutType.STUDY) {
			if(LasaLaraActivity.ninjaMode){
				v = inflater.inflate(R.layout.questioninfolayout_night, container, false);
			} else {
				v = inflater.inflate(R.layout.questioninfolayout, container, false);
			}
		} else if (layoutType == LayoutType.BOOK) {
			if(LasaLaraActivity.ninjaMode){
				v = inflater.inflate(R.layout.bookinfolayout_night, container, false);
			} else {
				v = inflater.inflate(R.layout.bookinfolayout, container, false);
			}
		} else if (layoutType == LayoutType.CHAPTER) {
			if(LasaLaraActivity.ninjaMode){
				v = inflater.inflate(R.layout.chapterinfolayout_night, container, false);
			} else {
				v = inflater.inflate(R.layout.chapterinfolayout, container, false);
			}
		} else {
			v = inflater.inflate(R.layout.infolayout, container, false);
		}
		return v;
	}
}
